﻿
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>订单详情</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="format-detection" content="telephone=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="css/animation.css">
    <link rel="stylesheet" href="css/light7.min.css">
    <link rel="stylesheet" href="css/light7-swipeout.css">
    <link rel="stylesheet" href="css/light7-swiper.min.css">
    <link rel="stylesheet" href="css/wap_style.css">

</head>
<style>
    #trade_details .bank_info {
        vertical-align: top
    }

    #trade_details .img {
        width: 60px;
        vertical-align: top;
        float: right
    }
</style>
<body>
<div class="page" id="trade_details">
    <header class="bar bar-nav  l-color">
        <a class="external icon pull-left return-icon back" href="{:url('order')}">
            <img src="picture/return_gray.png" width="100%">
        </a>
        <h1 class="header-title">订单详情</h1>
    </header>
    
    <div class="content transfer-content" >
        <div class="card list-item" style="padding: 0;">
            <div class="card-header" style="min-height: 2rem">
                订单信息 <span class="countdown color-danger"></span>
            </div>
            <div class="card-content" style="color: #999;line-height: 1.1rem">
                <div>支付金额 <span style="color:#000;font-size: 1rem;float: right">{$data.money*$data.price} CNY</span>
                </div>
                <div>买方：{$data.buy.nickname} &nbsp;&nbsp;卖方：{$data.sell.nickname}</div>
                <div>卖方推荐人：{$data.sell_up.nickname}</div>
                <div>数量：{$data.money} &nbsp;&nbsp;价格：{$data.price}</div>

                <div>下单时间：{$data.addtime}</div>
                <div>支付时间：{$data.amendtime}</div>
                <div>完成时间：{$data.endtime}</div>
            </div>
        </div>
        <div class="card list-item" style="padding: 0;">
            <div class="card-header">
                收款信息
            </div>
            <div class="card-content" style="line-height: 1.25rem;overflow: hidden">
                
                <div>
                    <span class="bank_info">{$data.receipt.types} {$data.receipt.name} {$data.receipt.account} {$data.receipt.image} {$data.receipt.branch} </span>
                </div>
                <div class="clx"></div>
                
            </div>
        </div>
        <div class="card list-item" style="padding: 0;">
            <div class="card-header">
                订单状态
            </div>
            <div class="card-content" style="color: #999;line-height: 1.25rem;">
                <div>
                    订单状态：
                        {if $data.types==2}
                            {if $data.b_or_s==1}
                                {if $data.uid == $data.usersid}
                                    {if $data.remit_img == ''}
                                        <span class="color-warning">待付款</span>
                                    {else}
                                        <span class="color-warning">等待对方收款</span>
                                    {/if}
                                {else}
                                    {if $data.remit_img == ''}
                                        <span class="color-warning">等待对方打款</span>
                                    {else}
                                        <span class="color-warning">待收款</span>
                                    {/if}
                                {/if}
                            {else}
                                {if $data.relative_id == $data.usersid}
                                    {if $data.remit_img == ''}
                                        <span class="color-warning">待付款</span>
                                    {else}
                                        <span class="color-warning">等待对方收款</span>
                                    {/if}
                                {else}
                                    {if $data.remit_img == ''}
                                        <span class="color-warning">等待对方打款</span>
                                    {else}
                                        <span class="color-warning">待收款</span>
                                    {/if}
                                {/if}
                            {/if}
                        {else}
                            <span class="color-success">交易完成</span>
                        {/if}
                </div>
                <div>付款凭证：
                    {if $data.remit_img == ''}
                        <input class="layui-upload-file" type="file" name="proimg">
                        <img class="img upload" data-id="{{id}}" src="picture/upload.png">
                    {else}
                        <img class="img upload show_img" data-id="{{id}}" src="{$data.remit_img}">
                    {/if}
                </div>
                <div class="clx"></div>
            </div>
        </div>
        {if ($data.b_or_s == 1 && $data.uid == $data.usersid && $data.remit_img == '')||($data.b_or_s == 2 && $data.relative_id == $data.usersid && $data.remit_img == '')}
            <button  class="click-btn" lay-click="confirm" id="buttons" data-id="{$data.id}"  data-s="" data-root="deal/index/affirm_pay"
                    data-title="您确认您已支付？" style="margin-bottom: 1rem;">
                    确认付款
            </button>
        {/if}
        {if $order.types == 2}
        {if ($data.b_or_s == 1 && $data.relative_id == $data.usersid && $data.remit_img != '')||($data.b_or_s == 2 && $data.uid == $data.usersid && $data.remit_img != '') }
        <button class="click-btn" lay-click="confirm" data-id="{$data.id}"   data-s="TrandConf.Confsk" data-root="deal/index/order_receipt"
                data-title="您确认您已收到款项？" style="margin-bottom: 1rem;">确认收款
        </button>
        {/if}
        {/if}<!-- 
        <button class="click-btn gray" lay-click="confirm" data-id="{{id}}" data-s="TrandConf.Stopjy" data-root="trand"
                data-title="您确认要暂停交易？" style="margin-bottom: 1rem;">暂停交易
        </button> -->
    </div>
</div>

<script type="text/javascript">
    var base_url = 'http://www.jiaoyi.com/';
</script>
<script type='text/javascript' src='js/jquery-3.3.1.min.js' charset='utf-8'></script>
<script type='text/javascript' src='js/light7.min.js' charset='utf-8'></script>
<script type='text/javascript' src='js/light7-swiper.min.js' charset='utf-8'></script>
<script type='text/javascript' src='js/light7-swipeout.js' charset='utf-8'></script>
<script type='text/javascript' src='js/cn.min.js' charset='utf-8'></script>
<script type='text/javascript' src='js/layui.js' charset='utf-8'></script>
<script type='text/javascript' src='js/basis.js' charset='utf-8'></script>
</body>
<script>
    $(function(){
        $(".upload").click(function(){
            $(this).siblings(".layui-upload-file").click();
        })
    })
</script>
<script type="text/javascript">
    function open(){
        console.log(111);
        return false;

    }
    $(".layui-upload-file").change(function() {
        var formData = new FormData();
        var files = this.files[0],
        thiss = $(this);
        formData.append('file',files);
        console.log(formData);
        $.ajax({
            type:'post',
            url:"{:url('uploadImage')}",
            data:formData,
            async:false,
            processData : false,
            contentType : false,
            dataType:'JSON',
            success:function(data){
                console.log(data)
                if(data.status == 0){
                    $('.upload').attr('src',data.url);
                    $('#buttons').data('s',data.url);
                    /*thiss.siblings('.moneyInfos').attr('src',data.url).show();
                    thiss.siblings('.moneyInfos').parents('.example2').attr('href', data.url);
                    $('#buyImage').val(data.url);
                    thiss.parents('.parents').data('url',data.url)*/
                }else{
                }
            },
            error:function(e){
            },
            beforeSend:function(e){
            }
        });
    });
                        $('#trade_details').off('click', '.show_img').on('click', '.show_img', function () {
                            var pics = [];
                            $('#trade_details .show_img').each(function (i, e) {
                                pics.push($(e).attr('src'));
                            })
                            var myPhotoBrowserStandalone = $.photoBrowser({
                                photos: pics
                            });
                            myPhotoBrowserStandalone.open();
                        })
        layui.loadPage({
            trade_details: function (id) {
                var data = $.Get(), basis = layui.basis, $this = this;

                data.root = 'wallet/c2c/order/detail'
                $this.sendAjax(data, function (d) {
                    if(d.payproof){
                        d.proimg = d.payproof;
                    }
                    var tpl = $.t7.compile($('#trade_details_tpl').html());
                    $('#trade_details .countdown').html('');
                    if (d.begin_time) {
                        basis.countdown(d.end_time * 1000, d.begin_time * 1000, function (d, s, e) {
                            var str = d[0] + '天' + d[1] + '时' + d[2] + '分' + d[3] + '秒';
                            $('#trade_details .countdown').html(str);
                        })
                    }


                    var htmlfun = function(d){

                        $('#trade_details .content').html(tpl(d));
                        $('#trade_details .upload').each(function () {
                            var $elem = $(this), pro_id = $elem.data('id');
                            $this.upload({
                                elem: $elem,
                                field: 'proimg'
                                , data: {

                                    id: pro_id,
                                    s: 'TrandConf.UploadpZ'
                                },
                                root: 'user/upload/dofile'
                            }, function (ds) {
                                d.payproof  = ds.imgurl;
                                d.proimg = ds.img_domain+ds.imgurl;
                                htmlfun(d);
                                // $elem.attr('src', d.img_domain+d.imgurl);
                                // $(".click-btn").attr('data-payproof', d.imgurl);

                            });
                        });
                        $('#trade_details .click-btn').data('remote', function (d) {
                            $.router.backReloadTime(1);
                            $.router.reloadPage();
                        })
                        
                    }

                    htmlfun(d);

                });


            }
        });
    </script>
</html>
